package com.itheima.day14;

import java.util.Arrays;
import java.util.HashMap;
import java.util.TreeMap;

public class Practice1 {
    public static void main(String[] args)   {

String file = "wo ai heima wo ai java wo yao hao hao xue xi java";
        TreeMap<String,Integer> map = new TreeMap<>();
        String[] s = file.split(" ");
        int count=0;
        for (String s1 : s) {
            for (String s2 : s) {
                if (s1.equals(s2)) {
                    count++;
                }
                map.put(s1,count);

            }
            count=0;
        }
        map.forEach((s1, integer) -> System.out.print(s1+"("+integer+")"));
    }
}
